//
//  State.h
//  Racing
//
//  Created by vy phan on 4/14/11.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "GameConstants.h"
@class Body;

//#define USE_BODY_OBJ

@interface State : NSObject {

	@public 
		float x;
		float y;
		float mass;
		float momentOfInertia;
		
		NSMutableArray* xpoints;
		NSMutableArray* ypoints;
		int numpoints;
	
		float vx;
		float vy;
		float angle;
		// van toc goc
		float angularVelocity;

	@protected
		float fx;
		float fy;
		// momen xoan
		float torque;
		bool colliding;
	@private
		float cx, cy, nx, ny;
		int numcollisions;
#ifdef USE_BODY_OBJ
		Body* outer;
#endif
}
//@property (readwrite) BOOL colliding;
-(id) initWithOuterBody:(Body*)outer_;
-(BOOL) isColliding;
-(float) speed;
-(void) applyForce:(float)x_ Y:(float)y_ FX:(float)fx_ FY:(float)fy_;
-(void) collide:(float)x_ Y:(float)y_ NX:(float)nx_ NY:(float)ny_;
-(void) collide:(float)x Y:(float)y NX:(float)nx NY:(float)ny Body:(Body*)body State:(State*)state;
-(void) computeCollisions;
-(void) halt;
-(void) integrate:(float)dt NextState:(State*)next;
@end
